public class Animal {
    String name="aaaa";

    public void eat(){
        System.out.println("吃东西。。。。。");

    }
}


class Dog extends Animal{

    String name;

    public Dog(String name) {
        this.name = name;
    }

    public void eat(){
       System.out.println("吃狗粮。。。");


    }




}

class Cat extends Animal{

    String name;

    public Cat(String name) {
        this.name = name;
    }

    public void eat(){
        System.out.println("吃猫粮。。。");


    }




}

class Test{

    public static void main(String[] args) {
        Animal animal=new Dog("旺财");
       animal.eat();
        animal=new Cat("小黑");
        animal.eat();

    }



}
